package cn.com.checne.controller.scheduler;

import java.util.Date;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.quartz.JobDetail;

import cn.com.checne.dao.NewsInfoDao;
import cn.com.checne.util.TimeUtils;

/**
 * 抓取主站新闻信息
 * 
 * @author zy
 * 
 */
public class PullChecNewsJobDetail extends JobDetail {
	private static final long serialVersionUID = 8233018678333175521L;

	protected final Logger logger_monitor = Logger.getLogger(PullChecNewsJobDetail.class);
	@Resource
	private NewsInfoDao newsDao;

	public void pullChecNews() {
		try {
			logger_monitor.info("[PullChecNewsJobDetail] #抓取主站新闻信息-start#");
			String yestoday = TimeUtils.getDate(new Date(), -1);
			newsDao.checCNNewsSynch(yestoday);
			newsDao.checENNewsSynch(yestoday);
			logger_monitor.info("[PullChecNewsJobDetail] #抓取主站新闻信息-end#");
			//处理完毕休息一分钟
//			Thread.sleep(60000);
		} catch (Exception e) {
			logger_monitor.error("[PullChecNewsJobDetail] #抓取主站新闻信息-ERROR# "
					+ e.getMessage(), e);
		}
	}

}
